package com.jaydenxiao.common.base;

import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;

/**
 * Created by hasee on 2017/10/10.
 */

public class BaseViewModel implements BaseFragment.DetachListener {


    protected CompositeDisposable disposables;

    public BaseViewModel() {
        disposables=new CompositeDisposable();
    }

    protected void addDisposable(Disposable disposable){
        disposables.add(disposable);
    }

    protected void clearDisposable(){
        disposables.clear();
        disposables=null;
    }


    @Override
    public void detach() {
        clearDisposable();
    }



}
